package org.dromara.system.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author 王星
 * @date 2024/7/1 下午5:00
 */
@AllArgsConstructor
@Getter
public enum QueryTypeEnum {
    ALL(0, "所有"),
    TEAM(1, "团队"),
    DIRECT(2, "直营"),
    JUNIOR(3, "下级"),
    DIRECT_AND_DIRECT(4, "直营+下级"),
    AGENT(5, "间接代理");

    private final Integer code;

    private final String name;

    public static QueryTypeEnum findOne(Integer code) {
        return Arrays.stream(QueryTypeEnum.values())
                .filter(type -> type.getCode().equals(code)).findAny().orElse(null);
    }
}
